#!/bin/bash

# Description: 自动测试
# File: tester.sh |Time: 2022-05-12 09:56

hash inotifywait
if [ $? -ne 0 ]; then
    echo "inotify-tools not exist, install inotify-tool"
    sudo apt install inotify-tools
fi

read -p "input file path >>> " file_path

if [[ ! (-f $file_path) ]]; then
    echo "file $file_path not exist"
    exit -1
fi

 while inotifywait -q -e  modify $file_path; do
    echo ""
    /bin/bash $file_path
    echo ""
done

